<?php
defined('BASEPATH') or exit('No direct script access allowed');

use chriskacerguis\RestServer\RestController;
use itbdw\Ip\IpLocation;

class Example extends RestController
{

    public function __construct()
    {
        // Construct the parent class
        parent::__construct();
        header("Access-Control-Allow-Origin: * ");
        $this->load->model(['site_model', 'sitecategory_model', 'siteproduct_model', 'siteuser_model', 'siteorder_model', 'sf_model']);
    }

    public function index_get()
    {
        $query = $this->db->query("SELECT
  country,
	count(*) as country_inquirys
FROM
	`dream_sites_order` 
	WHERE state !='-1'
	AND country is not null
	GROUP BY country
ORDER BY
	country_inquirys DESC
	LIMIT 5");
        echo json_encode($query->result_array());
    }
}
